<script type="text/javascript">
function calculateValue(){
if(document.getElementById("CodtranNumber").value!="" && document.getElementById("CodtranPrice").value!="")
	document.getElementById("CodtranValue").value=(document.getElementById("CodtranNumber").value * document.getElementById("CodtranPrice").value);
}
function calculatePrice(){
if(document.getElementById("CodtranNumber").value!="" && document.getElementById("CodtranValue").value!="")
	document.getElementById("CodtranPrice").value=(document.getElementById("CodtranValue").value / document.getElementById("CodtranNumber").value);
}
</script>
<?php echo $this->element('menu'); ?>
<div class="codtrans form">
<?php echo $this->Form->create('Codtran');?>
	<fieldset>
		<legend><?php __('Admin Edit Codtran'); ?></legend>
	<?php
		echo $this->Form->input('id');
		echo $this->Form->input('ComID', array('label'=>'ComName','options'=>$codetails));
		echo $this->Form->input('Date',array('minYear' => '1950','maxYear' => date("Y"),'dateFormat' => 'DMY', 'empty' => '(choose one)'));
		//echo $this->Form->input('Company');
		echo $this->Form->input('Code');
		echo $this->Form->input('Name',array("type"=>"hidden"));
		echo $this->Form->input('director_id', array('label'=>'Director Name',"selected"=>$this->data['Codtran']['director_id'],'options'=>$directors,"empty"=>"Choose one"));
		echo $this->Form->input('Transaction');
		echo $this->Form->input('Number');
		echo $this->Form->input('Price',array('onfocus'=>"calculatePrice();"));
		echo $this->Form->input('Value',array('onfocus'=>"calculateValue();"));
		echo $this->Form->input('Holding');
	?>
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>